WEBVTT

00:01.580 --> 00:03.520
Hello and welcome back to the costs.

00:03.530 --> 00:10.220
So in the last session we learned a lot about different data types and now we are continuing to increase

00:10.220 --> 00:13.490
our toolset and get familiar with operators.

00:13.550 --> 00:16.960
So operators allow us to have interactions between objects.

00:16.970 --> 00:23.990
And in this sense we are getting closer to work on real world problems where we have many interactions

00:23.990 --> 00:26.330
and relationships between objects.

00:26.330 --> 00:31.190
In this session we also get familiar with the special data type of billions.

00:31.430 --> 00:34.000
But for now let's start with them.

00:34.030 --> 00:38.320
Arithmetic operators and yeah actually we already know most of them.

00:38.330 --> 00:44.840
And this part here is the smallest the repetition classify we have so you are right about we have a

00:44.840 --> 00:50.330
equals five B equals two and C equals seven.

00:50.420 --> 00:56.760
And we know that began at two integers so A plus B gives a seven.

00:56.800 --> 00:59.240
You can subtract two integers A minus.

00:59.240 --> 01:00.200
Big ifs.

01:00.290 --> 01:06.020
Three you can multiply eight times B gives us 10.

01:06.080 --> 01:09.560
We can divide a divided by B.

01:09.560 --> 01:11.110
Give us 2.5.

01:11.120 --> 01:17.210
So this is a float object and that's another operation called flaw divide.

01:17.240 --> 01:18.670
So it's.

01:18.740 --> 01:24.710
So here we have two to slash all sexually and the fifth run the cell.

01:25.520 --> 01:32.000
So we have a division here and then yeah actually v v rounded down to the next integer in this case

01:32.000 --> 01:34.830
too and we can also have an exponential.

01:34.820 --> 01:43.160
So a to the power of B gives us 25 and that's an operator model law.

01:43.460 --> 01:46.500
Let's run this out here model August.

01:46.610 --> 01:49.890
The remainder of the division a divided by B.

01:49.970 --> 01:58.890
So let's check a divided by being five two divided by two is two and the remainder is one.

01:58.900 --> 02:06.880
All right so let's head to comparison operators and ask before we assign some arrivals and then what

02:06.880 --> 02:15.700
we are doing we are comparing is a equal to B and you have to be careful here it's a double equal sign.

02:15.790 --> 02:24.070
So a single equals sign would actually assign a equals b about a double equal sign checks if A is equal

02:24.070 --> 02:27.100
B and then returns true if is equal B.

02:27.640 --> 02:30.970
And the returns are false if A is not equal B.

02:31.930 --> 02:34.880
So here we have a is 5 B is 2.

02:34.930 --> 02:38.110
So I would expect that we get on false

02:41.410 --> 02:45.860
now next operation a exclamation mark equal B.

02:45.950 --> 02:48.110
So what this operation does.

02:48.110 --> 02:52.800
It actually checks if A is not equal to be so.

02:53.060 --> 02:57.740
Yeah we know here a is not equal to be so it should give us a true.

02:58.250 --> 02:59.890
Then we have the less sine.

02:59.900 --> 03:05.110
So the less sine checks if A is smaller or less than B.

03:05.110 --> 03:14.130
And we would expect the false here and we have the greater than sign and this checks of A is greater

03:14.130 --> 03:21.720
than B I would assume that we get a true and we can also do more complex operations so we can check

03:21.720 --> 03:26.380
if A plus B is less are equal than C.

03:26.460 --> 03:30.360
So A plus B seven C is seven.

03:30.360 --> 03:34.500
So C is less or equal than seven.

03:34.500 --> 03:37.140
That's true.

03:37.160 --> 03:44.600
So now before the operators they give us true or false s as a result of the comparison and true and

03:44.600 --> 03:46.160
false they are both.

03:46.180 --> 03:48.660
Yeah especially the data types called boolean.

03:48.710 --> 03:57.770
And if you check the type of truth it gives us bool for boolean and we can also check about the true

03:57.810 --> 04:05.560
stands numerically far by transforming true into an integer and true all A stands for one and we can

04:05.560 --> 04:10.750
also transform faults into an integer and force always stands for zero.

04:10.960 --> 04:12.420
And we can do it the other way around.

04:12.420 --> 04:21.170
We can transform an integer into a pool object and let's try it with one so this gives us a true.

04:21.170 --> 04:25.920
And also if you transform life into beauty this gives us also a true.

04:26.210 --> 04:27.100
And the rules.

04:27.170 --> 04:29.250
Each integer or float.

04:29.300 --> 04:32.690
That is not equal to zero gives us the true.

04:32.690 --> 04:39.680
If we transform it into a pool soon the only number or integer which gives us the false if we transform

04:39.680 --> 04:43.220
it into pool is zero actually.

04:43.220 --> 04:50.180
And you can also check the mathematical behavior of true and false by applying arithmetic operations

04:50.180 --> 04:54.040
so we can calculate five times true true stands for one.

04:54.050 --> 04:55.490
So we would expect five.

04:55.690 --> 04:57.440
And that's true.

04:57.440 --> 05:03.110
And we can also make an addition so five plus true guess six.

05:03.170 --> 05:09.180
And let's try the same with false or five times false returns zero.

05:09.500 --> 05:14.750
And we can also assign a brilliant object to our rivals so that's known no problem.

05:14.750 --> 05:16.990
So five equals two.

05:16.990 --> 05:26.610
That's false and we assign false to the variety the empty is now stands for False and we can also then

05:26.610 --> 05:28.520
make operations on the.

05:28.530 --> 05:32.400
So five times the D stands for False gives us zero.

05:33.120 --> 05:40.140
So earlier when we learned about lists we learned that in a list we can actually start each data table

05:40.180 --> 05:40.950
object.

05:40.980 --> 05:44.990
Yeah we can think of and this holds also true for a boolean.

05:45.010 --> 05:47.030
We can put a boolean into a list.

05:47.910 --> 05:56.480
So now let's execute the list L so on the list l this a integer 1 2 integers that's a string cat that's

05:56.480 --> 06:02.500
a float object at one point five and that's a boolean object true.

06:02.510 --> 06:06.520
All right so let's go ahead with a logical operators.

06:06.740 --> 06:14.990
So in the first one this and and this is the so-called logical end and was in logical end does it checks

06:15.140 --> 06:23.390
if all conditions are true and only if conditions are true then we get a true or so true and true gifts

06:23.400 --> 06:25.880
less true if both are true.

06:25.940 --> 06:28.700
So that's easy here in that case.

06:28.700 --> 06:35.390
Now it's getting a bit more difficult so we have two conditions five greater than two and seven greater

06:35.390 --> 06:36.650
than two.

06:36.740 --> 06:45.320
So we know both conditions are true then we should get a true here and in most cases the end sign works

06:45.350 --> 06:51.500
in the same way so there are some some minor cases that doesn't work but I don't want to go into detail

06:51.500 --> 06:52.190
here.

06:52.750 --> 06:54.750
So to introduce true.

06:55.270 --> 07:00.150
And also 5 greater than 2 and 7 greater than to give us 2.

07:00.170 --> 07:02.580
So let's go ahead with true and false.

07:02.610 --> 07:08.390
So we only get a true if both statements are true but obviously false is not true.

07:08.390 --> 07:12.420
Now we have 5 greater than 2 and 7 less than 2.

07:12.440 --> 07:18.400
So obviously 7 less than 2 is false and not all conditions are true.

07:18.410 --> 07:25.740
So we should get a false and also false and false will give us a false and five.

07:25.850 --> 07:34.730
Less than two is false and seven less than two is also false so we should get a false okay.

07:34.740 --> 07:42.990
Let's continue with the logical are so logical are checks the statements and it gives us a true if at

07:42.990 --> 07:45.660
least one conditional statement is true.

07:46.260 --> 07:51.180
So if you have true are true that gives us the true costs at least one condition is true.

07:51.180 --> 07:58.630
So yeah both conditions true alternatively you can use the pipe symbol for or so on.

07:58.740 --> 08:04.590
Yeah the very most cases this also works so depends on whether your keyboard is uh American English

08:04.590 --> 08:05.620
or European one.

08:05.710 --> 08:10.890
You can find the pipe symbol and also with the type symbol true or true.

08:10.980 --> 08:21.060
Gives us true and also five greater to or seventh grader to guess as true true or false gives us also

08:21.090 --> 08:31.470
a true because at least one condition is true and this is also the same as 5 greater than 2 are 7 less

08:31.470 --> 08:39.750
to us or 5 greater 2 is a true statement so this gives us true and false and false gives us a false

08:39.780 --> 08:47.480
because no no statement is true here and last but not least we have the not logical operator so the

08:47.500 --> 08:51.420
not logical operator simply reverses true and false.

08:51.420 --> 08:56.480
So if we have actually false and say Not false is true.

08:56.490 --> 09:04.890
So that's quite easy and not true as false and last but not least now we have a bit more complicated

09:04.890 --> 09:05.800
example.

09:05.970 --> 09:18.420
We start here with this bracket 5 greater 2 is true not true is false false or false gives false and

09:18.420 --> 09:23.760
then here outside the record is not so not false should give us true.

09:25.290 --> 09:27.280
So that's it for the upper right us.

09:27.300 --> 09:31.490
And I hope you enjoyed it and you will see us in the next session.

09:31.490 --> 09:35.070
Uh about conditional statements if elif X and Y.

09:35.640 --> 09:37.020
So seen by.
